package com.cdj.common.activity;

import android.os.Bundle;

import androidx.annotation.Nullable;

import butterknife.ButterKnife;
import butterknife.Unbinder;
import me.yokeyword.fragmentation.SupportActivity;

/**
 * ---------------------------------------------------------<br />
 * desc：<br />
 * author：chendeji <br />
 * date：2021/6/3<br />
 * email：18701434169@163.com<br />
 * qq: 781571323
 * wx: melody_2009
 * ---------------------------------------------------------<br />
 */
abstract public class BaseActivity extends SupportActivity {

    private Unbinder unbind;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        beforeContentView();
        setContentView(getContentId());
        unbind = ButterKnife.bind(this);
        initView(savedInstanceState);

    }

    protected abstract void beforeContentView();

    protected abstract void initView(Bundle savedInstanceState);

    @Override
    protected void onDestroy() {
        unbind.unbind();
        super.onDestroy();
    }

    protected abstract int getContentId();
}
